<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access'); 
JHTML::_('behavior.tooltip');
?>
<script language="javascript">
	var arrCheck = new Array();
	
	function checkOnSubmit(){
		var frm = document.adminForm;
		if(frm.ElementName.value == ''){
			alert('<?php echo JText::_( 'ELEMENT NAME COULD NOT BE EMPTY' ); ?>');
			frm.ElementName.focus();
			return ;
		}
		frm.submit();
	}
</script>
<form action="#" method="post" name="adminForm" id="adminForm">
<div class="col100">
	<?php echo $this->menu_User();?>
        	<br/>
	<fieldset class="adminform">
	
		<legend><?php echo JText::_( 'CONFIG XML SCHEMA FOR')." ".$this->data->SchemaName; ?></legend>
	
		<fieldset class="adminform" style="width:320px; float:left">
		<legend><?php echo $this->title.JText::_( ' Element' ); ?></legend>
		<b><font color="Red"><?php echo $this->msg;?></font></b>
		<table class="admintable" border="1px" style="border-collapse:collapse;  border-color:#CCCCCC">
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_('ELEMENT NAME'); ?>::<?php echo JText::_('EX: IF YOU WANT EXPORT AS <CODE><LOCATION>USA</LOCATION></CODE> THE ELEMENT NAME IS LOCATION'); ?>">
					<?php echo JText::_('ELEMENT NAME'); ?>: 
					</span>
				</td>
				<td>
					<input class="text_area" type="text" name="ElementName" id="ElementName" size="40" maxlength="250" value="<?php echo $this->details->ElementName;?>" /><br>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'PARENT ELEMENT' ); ?>::<?php echo JText::_( 'USE THIS TO BUILD THE XML FILE DOCUMENT TREE DISPLAYED ON THE RIGHT' ); ?>">
					<?php echo JText::_( 'PARENT ELEMENT' ); ?>: 
					</span>
				</td>
				<td>
					<?php echo $this->buildSelectboxXMLStructure($this->data->SchemaID, ($this->details->ParentID == null)?JRequest::getVar("ParentID",""):$this->details->ParentID); ?><br>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'ATTRIBUTES' ); ?>::<?php echo JText::_( 'Ex: if you want to export as |rss version=2.0| then the attribute is: version=2.0' ); ?>">
					<?php echo JText::_( 'ATTRIBUTES' ); ?>: 
					</span>
				</td>
				<td>
					<input class="text_area" type="text" name="FieldAttributes" id="FieldAttributes" size="40" maxlength="250" value="<?php echo htmlentities($this->details->FieldAttributes);?>" /><br>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'IS PIVOT' ); ?>::<?php echo JText::_("YES, MAKE THIS ENTITY THE PIVOT ENTITY WHICH WILL BE ITERATED DURING THE XML FEED GENERATION. EACH FEED CAN ONLY CONTAIN 1 PIVOT ENTITY");?>">
					<?php echo JText::_( 'IS PIVOT' ); ?>:
					</span>
				</td>
				<td>
					<input value="Y" <?php if($this->details->IsPivot == "Y") echo 'checked="checked"'; ?> name="IsPivot" type="radio" id="PivotYes"><label for="PivotYes"><?php echo JText::_("YES");?></label> <br>
					<input value="N" <?php if($this->details->IsPivot == "N" || $this->details->IsPivot == null ) echo 'checked="checked"'; ?> name="IsPivot" type="radio" id="PivotNo"><label for="PivotNo"><?php echo JText::_("NO");?></label>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<label for="IsCDATA">
						<?php echo JText::_( 'IS CDATA' ); ?>:
					</label>
				</td>
				<td>
					<input value="Y" <?php if($this->details->IsCDATA == "Y") echo 'checked="checked"'; ?> name="IsCDATA" type="radio" id="CDATAYes"><label for="CDATAYes"><?php echo JText::_("YES, EXPORT THE DATA USING CDATA NOTATION");?>.</label> <br>
					<input value="N" <?php if($this->details->IsCDATA == "N" || $this->details->IsCDATA == null ) echo 'checked="checked"'; ?> name="IsCDATA" type="radio" id="CDATANo"><label for="CDATANo"><?php echo JText::_("NO, EXPORT AS XML ENTITIES");?></label>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<label for="IsMandatory">
						<?php echo JText::_( 'IS MANDATORY' ); ?>:
					</label>
				</td>
				<td>
					<input value="Y" <?php if($this->details->IsMandatory == "Y") echo 'checked="checked"'; ?> name="IsMandatory" type="radio" id="IsMandatoryYes"><label for="IsMandatoryYes"><?php echo JText::_("YES, THIS ELEMENT MUST BE ALWAYS PRESENT IN THE FEED. INDICATED BY A");?> <font color="Red">*</font></label> <br>
					<input value="N" <?php if($this->details->IsMandatory == "N" || $this->details->IsMandatory == null ) echo 'checked="checked"'; ?> name="IsMandatory" type="radio" id="IsMandatoryNo"><label for="IsMandatoryNo"><?php echo JText::_("NO");?>.</label>
					<input type="hidden" name="NumField" value="1" value="<?php $this->details->NumField ?>"/>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'STATIC DATA' ); ?>::<?php echo JText::_( 'OPTIONAL. INSTEAD OF SPECIFYING A DATA FIELD TO BIND, YOU MAY HAVE THIS ELEMENT CONTAIN STATIC HARD-CODED DATA, OR SPECIAL VARIABLES. HERE ARE THE VARIABLES FOR USE' ); ?>">
					<?php echo JText::_( 'STATIC DATA' ); ?>:
					</span>
				</td>
				<td>
				<input class="text_area" type="text" name="StaticData" id="StaticData" size="40" maxlength="250" value="<?php echo $this->details->StaticData;?>" /><br>
				<br/>Some static data you can choose:
				<select style="width:200px" onchange="document.getElementById('StaticData').value = this.value;">
				<option value="%SITE_NAME%"><font color="Blue">%SITE_NAME%</font> - <?php echo JText::_( 'NAME OF YOUR SITE' ); ?></option>
				<option value="%SITE_DESCRIPTION%"><font color="Blue">%SITE_DESCRIPTION%</font> - <?php echo JText::_( "SITE'S DESCRIPTION" ); ?></option>
				<option value="%SITE_CONTACT_EMAIL%"><font color="Blue">%SITE_CONTACT_EMAIL%</font> - <?php echo JText::_( "CONTACT EMAIL" ); ?></option>
				<option value="%BASE_HTTP_PATH%"><font color="Blue">%BASE_HTTP_PATH%</font> - <?php echo JText::_( "DIRECT LINK TO YOUR SITE" ); ?></option>
				<option value="%EXPIRE_DATE%"><font color="Blue">%EXPIRE_DATE%</font> - <?php echo JText::_( "EXPIRATION DATE OF THE RECORD" ); ?></option>
				<option value="%LINK%"><font color="Blue">%LINK% </font>- <?php echo JText::_( "DIRECT LINK TO THE RECORD" ); ?></option>
				<option value="%DATE%"><font color="Blue">%DATE%</font> - <?php echo JText::_( "DATE THE RECORD WAS CREATED / UPDATED (YEAR-MONTH-DATE FORMAT)" ); ?></option>
				<option value="%DATE_RFC%"><font color="Blue">%DATE_RFC%</font> - <?php echo JText::_( "DATE THE RECORD WAS CREATED / UPDATED (RFC 2822 FORMATTED)" ); ?></option>
				<option value="%DEFAULT_LANG%"><font color="Blue">%DEFAULT_LANG%</font> - <?php echo JText::_( "DEFAULT LANGUAGE OF YOUR SITE" ); ?></option>
				<option value="%RSS_FEED_LOGO%"><font color="Blue">%RSS_FEED_LOGO%</font> - <?php echo JText::_( "LINK TO THE RSS LOGO IMAGE" ); ?></option>
				<option value="%RSS_LOGO_HEIGHT%"><font color="Blue">%RSS_LOGO_HEIGHT%</font> - <?php echo JText::_( "IMAGE HEIGHT" ); ?></option>
				<option value="%RSS_LOGO_WIDTH%"><font color="Blue">%RSS_LOGO_WIDTH%</font> - <?php echo JText::_( "IMAGE WIDTH" ); ?></option>
				<option value="%FEED_DATE%"><font color="Blue">%FEED_DATE%</font> - <?php echo JText::_( "DATE OF FEED'S GENERATION" ); ?></option>
				</select>
				</td>
			</tr>
			<tr>
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'STATIC DATA OPTIONS' ); ?>::<?php echo JText::_( 'THESE OPTIONS ARE USEFUL IF YOU WANT TO HAVE THE STATIC DATA  APPENDED/PREPENDED TO THE EXPORTED ATTRIBUTES');?>">
					<?php echo JText::_( 'STATIC DATA OPTIONS' ); ?>:
					</span>
				</td>
				<td>
				<input value="A" <?php if($this->details->StaticMod == "A") echo 'checked="checked"'; ?> name="StaticMod" type="radio"><?php echo JText::_( "APPEND TO THE END" ); ?><br>
				<input value="P" <?php if($this->details->StaticMod == "P") echo 'checked="checked"'; ?> name="StaticMod" type="radio"><?php echo JText::_( "PREPEND TO THE START" ); ?><br>
				<input value="F" <?php if($this->details->StaticMod == "F" || $this->details->StaticMod == null ) echo 'checked="checked"'; ?> name="StaticMod" type="radio"><?php echo JText::_( "FILL (DEFAULT)" ); ?><br>
				</td>
			</tr>
			<tr align="left">
				<td align="left" class="key" colspan="2">					
						<div align="left"><?php echo JText::_( 'DATA FILTERING OPTIONS' ); ?>:</div>
				</td>
			</tr>
			<tr >
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'IS BOOLEAN' ); ?>::<?php echo JText::_( "YES. WILL BE EXPORTED AS TRUE OR FALSE DEPENDING ON IF A VALUE WAS MATCHED" ); ?>">
					<?php echo JText::_( 'IS BOOLEAN' ); ?>:
					</span>
				</td>
				<td>
				<input value="Y" <?php if($this->details->IsBoolean == "Y") echo 'checked="checked"'; ?> name="IsBoolean" type="radio"><?php echo JText::_( "YES" ); ?><br>
				<input value="N" <?php if($this->details->IsBoolean == "N" || $this->details->IsBoolean == null ) echo 'checked="checked"'; ?> name="IsBoolean" type="radio"><?php echo JText::_( "NO" ); ?>
				</td>
			</tr>
			<tr >
				<td width="60" align="right" class="key">
					<label for="CodeProType">
						<?php echo JText::_( 'RADIO-BUTTONS, CHECKBOXES, SELECTS' ); ?>:
					</label>
				</td>
				<td>
				<input value="Y" <?php if($this->details->CodeProType == "Y") echo 'checked="checked"'; ?> name="CodeProType" type="radio"><?php echo JText::_( "CONVERT CODES TO THEIR FULL NAME, EG US BECOMES U.S.A." ); ?><br>
				<input value="N" <?php if($this->details->CodeProType == "N" || $this->details->CodeProType == null ) echo 'checked="checked"'; ?> name="CodeProType" type="radio"><?php echo JText::_( "EXPORT CODED FIELDS AS THEIR CODE. (DEFAULT)" ); ?>
				</td>
			</tr>
			<tr >
				<td width="60" align="right" class="key">
					<label for="CatProType">
						<?php echo JText::_( 'CATEGORY FIELDS' ); ?>:
					</label>
				</td>
				<td>
				<input value="Y" <?php if($this->details->CatProType == "Y") echo 'checked="checked"'; ?> name="CatProType" type="radio"><?php echo JText::_( "CONVERT CATEGORY NUMBERS TO THEIR FULL NAME" ); ?>.<br>
				<input value="N" <?php if($this->details->CatProType == "N" || $this->details->CatProType == null ) echo 'checked="checked"'; ?> name="CatProType" type="radio"><?php echo JText::_( "EXPORT AS CATEGORY IDS. (DEFAULT)" ); ?>
				</td>
			</tr>
			<tr >
				<td width="60" align="right" class="key">
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'TRUNCATE' ); ?>::<?php echo JText::_( "ENTER A NUMBER. 0 : DO NOT TRUNCATE" ); ?>">
					<?php echo JText::_( 'TRUNCATE' ); ?>:
					</span>
				</td>
				<td>
				<?php echo JText::_( 'TRUNCATE TO' ); ?> <input value="<?php echo ($this->details->truncate == null)?"0":$this->details->truncate;?>" size="3" name="NumTruncate" type="text"> <?php echo JText::_( "CHARACTERS" ); ?>.
				</td>
			</tr>
			<tr >
				<td width="60" align="right" class="key">
					<label for="IsStripTag">
						<?php echo JText::_( 'STRIP HTML TAGS' ); ?>:
					</label>
				</td>
				<td>
				<input value="Y" <?php if($this->details->IsStripTag == "Y") echo 'checked="checked"'; ?> name="IsStripTag" type="radio"><?php echo JText::_("Yes");?><br>
				<input value="N" <?php if($this->details->IsStripTag == "N" || $this->details->IsStripTag == null ) echo 'checked="checked"'; ?> name="IsStripTag" type="radio"><?php echo JText::_("NO (DEFAULT)");?>
				</td>
			</tr>
			<tr >
				<td colspan="2" align="center"><br>
				<input type="button" name="btnSubmit" onclick="checkOnSubmit();" value="<?php echo JText::_("SAVE ELEMENT");?>"> </br> </br>
				</td>
			</tr>
		</table>
		</fieldset>
		<fieldset class="adminform" style=" float:left">
		<legend><?php echo JText::_( 'XML DOCUMENT TREE' ); ?></legend>
		<table class="admintable">
			<tr>
				<td><?php $this->fcnBuildXMLDocumentTree($this->data->SchemaID); ?></td>
			</tr>
			</tr>
		</table>
		</fieldset>
	</fieldset>
</div>
<div class="clr"></div>

<input type="hidden" name="option" value="com_jajobboard" />
<input type="hidden" name="ElementID" value="<?php echo $this->details->ElementID;?>" />
<input type="hidden" name="SchemaID" value="<?php echo $this->data->SchemaID;?>" />
<input type="hidden" name="cid[]" value="<?php echo $this->data->SchemaID;?>" />
<input type="hidden" name="act" value="save" />
<input type="hidden" name="task" value="configxml" />
<input type="hidden" name="tab" value="schemas" />
<input type="hidden" name="view" value="jaxmlexport" />
</form>